Statistical modelling / Fitting Wood's curve
If we now look at the GenStat Input file we can see how the instructions are represented

    MODEL logmilk_1[1]
    TERMS [FACT=9] logday_1[1],day_1[1]
    FIT [PRINT=model, summary, estimates; CONSTANT=estimate;\
    FPROB=yes; TPROB=yes; FACT=9] logday_1[1],day_1[1]
    RKEEP ; ESTIMATES=Est[1]

We copy these statements into an Input window and modify them by incorporating a loop 'For [NTIMES=77]' and replacing the [1] in each of the variate names by [I]. As we shall need to calculate average values for the three estimates we can incorporate statements to do this with the final values stored in the variate 'MeanEst'.

    VARIATE [NVALUES=3;VALUES=0,0,0] SumEst,MeanEst
    SCALAR [VALUE=0] I
    FOR [NTIMES=77]
    CALCULATE I=I+1
    MODEL logmilk_1[I]
    TERMS [FACT=9] logday_1[I],day_1[I]
    FIT [PRINT=model, summary, estimates; CONSTANT=estimate;\
    FPROB=yes; TPROB=yes; FACT=9] logday_1[I],day_1[I]
    RKEEP ; ESTIMATES=Est[I]
    CALCULATE SumEst = SumEst + Est[I]
    ENDFOR
    CALCULATE MeanEst = SumEst/77
    PRINT MeanEst

We then use Run Submit Selection to complete the calculations.

Table of content  Back     next